import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:vape_xe/services/services.dart';
import 'package:vape_xe/utils/utils.dart';
import 'package:vape_xe/values/values.dart';
import 'package:vape_xe/widgets/widgets.dart';

import 'logic.dart';

class WithdrawConfirmView extends Dialog {
  final Map<String, dynamic> params;

  const WithdrawConfirmView({super.key, required this.params});

  @override
  Widget build(BuildContext context) {
    return GetX<WithdrawConfirmController>(
      init: Get.put(WithdrawConfirmController(params)),
      builder: (controller) => Container(
        decoration: BoxDecoration(
          color: Colors.black,
          borderRadius: const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
          boxShadow: [Shadows.dialogShadow],
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            23.hGap,
            Center(child: Text('Reconfirmation'.tr, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.sp))),
            27.hGap,
            Padding(
              padding: EdgeInsets.only(left: 32.w),
              child: Text('Withdraw amount'.tr, style: const TextStyle(color: AppColors.secondaryText)),
            ),
            16.hGap,
            InnerContainerWidget(
              margin: EdgeInsets.only(left: 29.w, right: 32.w),
              child: Row(
                children: [
                  16.vGap,
                  Text(
                    ConfigStore.to.currency,
                    style: TextStyle(fontFamily: 'Montserrat', fontWeight: FontWeight.bold, fontSize: 12.sp),
                  ),
                  4.vGap,
                  Expanded(
                    child: Text(
                      controller.params['money'],
                      style: TextStyle(color: Colors.white, fontSize: 20.sp, fontWeight: FontWeight.bold),
                    ),
                  ),
                  16.vGap,
                ],
              ),
            ),
            20.hGap,
            Padding(
              padding: EdgeInsets.only(left: 32.w),
              child: Text('Withdraw address'.tr, style: const TextStyle(color: AppColors.secondaryText)),
            ),
            Container(
              height: 56.h,
              margin: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.h),
              decoration: BoxDecoration(color: Colors.white10, borderRadius: 12.radius),
              child: Row(
                children: [
                  16.vGap,
                  Image.asset(
                    controller.params['type'] == 3 ? 'assets/images/ic_duitnow.webp' : 'assets/images/ic_usdt.webp',
                    width: 28.w,
                    height: 28.w,
                  ),
                  12.vGap,
                  Expanded(
                    child: Text(
                      controller.params['uniqueId'],
                      style: TextStyle(fontSize: 12.sp, fontFamily: 'Montserrat'),
                    ),
                  ),
                  12.vGap,
                ],
              ),
            ),
            8.hGap,
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 32.w),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  GestureDetector(
                    onTap: () => Navigator.pop(context),
                    child: Container(
                      width: 177.w,
                      height: 48.h,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(color: Colors.white10, borderRadius: 12.radius),
                      child: Text(
                        'Cancel'.tr,
                        style: const TextStyle(fontFamily: 'Montserrat', fontWeight: FontWeight.bold),
                      ),
                    ),
                  ),
                  GestureDetector(
                    onTap: () => controller.submit(),
                    child: Container(
                      width: 177.w,
                      height: 48.h,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        borderRadius: 12.radius,
                        gradient: const LinearGradient(colors: [Color(0xffF5B946), Color(0xffF58546)]),
                      ),
                      child: Text(
                        'Confirm'.tr,
                        style: const TextStyle(fontFamily: 'Montserrat', fontWeight: FontWeight.bold),
                      ),
                    ),
                  )
                ],
              ),
            ),
            12.hGap,
          ],
        ),
      ),
    );
  }
}
